<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>新增退费</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="新增,退费">
	<meta http-equiv="description" content="This is my page">
	
	<base target="_self">
  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'${tuitionDetail.chargeIndex.indexName}退费'}]"/>
    			<jsp:param name="width" value="80%"/>
    		</jsp:include>
    		
    		<s:hidden id="refundId" name="refundDetail.refund.id"></s:hidden>
    		<s:hidden id="indexId" name="refundDetail.chargeIndex.id" value="%{tuitionDetail.chargeIndex.id}"></s:hidden>
    		<s:hidden id="maxAmount" name="maxRefundAmount" value="%{tuitionDetail.amount}"></s:hidden>
    		<input type="hidden" id="yearMonth" name="refundDetail.chargeDate" value="<s:date name='tuitionDetail.tuitionDateStart' format='yyyy-MM-dd' />" />
    		<s:hidden id="tuitionDetailId" name="refundDetail.tuitionDetail.id" value="%{tuitionDetail.id}"></s:hidden>
    		
    		<table cellspacing="1" cellpadding="3" width="100%" bgcolor="#CCCCCC">
				<tr bgcolor="#FFFFFF">
					<td align="right" width="40%" class="label">
						最高退费金额(￥)：
					</td>
					<td align="left" width="60%">
						<s:property value="tuitionDetail.intAmount"/>
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="right" class="label">
						实际退费金额(￥)：
					</td>
					<td align="left">
						<s:textfield name="refundDetail.amount" id="amount" cssStyle="width:120px" maxlength="8"></s:textfield>
					</td>
				</tr>
				<tr bgcolor="#FFFFFF">
					<td align="right" class="label">
						备注：
					</td>
					<td align="left">
						<s:textarea name="refundDetail.remark" id="remark" cssStyle="width:98%; height:80px;"></s:textarea>
					</td>
				</tr>
			</table>
			
			<table width="100%" cellspacing="0">
    			<tr>
    				<td align="center" valign="bottom" height="30">
    					<input type="button" value="新增" class="btn" onclick="addRefundDetail()" />
    				</td>
    			</tr>
    		</table>
    		
    	</s:form>
    </center>
    
    <script type="text/javascript">
    function addRefundDetail()
    {
        var amount = $('#amount');
        var maxAmount = $('#maxAmount');
        var remark = $('#remark');
        if(checkInteger(amount) == false)
        {
			showMsg('实际退费金额只能为整数。', function(){
				amount.focus();
			});
			return;
        }
        if(parseFloat(maxAmount.val(), 10) < parseFloat(amount.val(), 10))
        {
        	showMsg('实际退费金额不能大于最高退费金额。', function(){
        		amount.focus();
			});
			return;
        }
        if(remark.val().length > 200)
        {
        	showMsg('备注不能超过200字。', function(){
        		remark.focus();
			});
			return;
        }
        var url = 'inner/charge/addRefundDetail.action';
		ajaxAction(url, 'post', 'frm', false, function(){
			var pWin = getParentWin();
			pWin.searchThis();
			window.close();
		});
    }
    </script>
  </body>
</html>
